package com.youzan.cloud.component.biz.member.service.impl;
import com.youzan.cloud.base.api.BifrostService;
import com.youzan.cloud.component.biz.member.common.util.OutResultUtil;
import com.youzan.cloud.component.biz.member.dto.BaseResult;
import com.youzan.cloud.component.biz.member.dto.LogDTO;
import com.youzan.cloud.component.biz.member.dto.MemberBaseDto;
import com.youzan.cloud.component.biz.member.service.IBaseService;
import com.youzan.cloud.component.biz.member.youzanopen.api.YzMemberApiService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
/**
 * @author jinzetao
 * @version 1.0
 * @description: ISV主动获取会员等级信息
 * @date 2021/8/3 15:19
 */
@Service
@Slf4j
public class MemberGradeService extends AbstractService implements IBaseService {
    @Autowired
    RedisTemplate redisTemplate;
    @Autowired
    BifrostService bifrostService;

    @Autowired
    private YzMemberApiService yzMemberApiService;

    @Override
    public LogDTO buildLog(Object inputParam) {
        // TODO 处理入参和日志对象的转换
        return null;
    }

    @Override
    public BaseResult handleException(Exception e) {
        // TODO 捕获异常
        return OutResultUtil.fail("组件异常!","500",e);
    }

    @Override
    public BaseResult doBiz(MemberBaseDto memberBaseDto) {
        String yzOpenId = memberBaseDto.getYzOpenId();
        return yzMemberApiService.getMemberLevel(yzOpenId,memberBaseDto.getKdtId(),memberBaseDto);
    }
}
